var cubeVertexPositionBuffer = null;
var cubeVertexTextureCoordBuffer = null;
var cubeVertexIndexBuffer = null;
function loadCube() {
	var vertexPositions = [
		// left cube Front face
		-5.0, -5.0,  5.0,
		5.0, -5.0,  5.0, 
		5.0,  5.0,  5.0, 
		-5.0,  5.0,  5.0, 

		// left cube Back face
		-5.0, -5.0, -5.0, 
		-5.0,  5.0, -5.0, 
		5.0,  5.0, -5.0, 
		5.0, -5.0, -5.0, 

		// left cube Top face
		-5.0,  5.0, -5.0,
		-5.0,  5.0,  5.0, 
		5.0,  5.0,  5.0, 
		5.0,  5.0, -5.0, 

		// left cube Bottom face
		-5.0, -5.0, -5.0, 
		5.0, -5.0, -5.0, 
		5.0, -5.0,  5.0, 
		-5.0, -5.0,  5.0, 

		// left cube Right-front
		5.0, -5.0, 1.0, 
		5.0,  5.0, 1.0, 
		5.0,  5.0,  5.0, 
		5.0, -5.0,  5.0, 

		// left cube Right-back
		5.0, -5.0, -5.0, 
		5.0,  5.0, -5.0, 
		5.0,  5.0,  -1.0, 
		5.0, -5.0,  -1.0, 

		// left cube Left face
		-5.0, -5.0, -5.0, 
		-5.0, -5.0,  5.0, 
		-5.0,  5.0,  5.0, 
		-5.0,  5.0, -5.0, 

		//connect front face
		5.0, -5.0,  1.0, 
		20.0, -5.0,  1.0, 
		20.0,  5.0,  1.0, 
		5.0,  5.0,  1.0, 

		//connect back face
		5.0, -5.0, -1.0, 
		5.0,  5.0, -1.0, 
		20.0,  5.0, -1.0, 
		20.0, -5.0, -1.0, 

		//connect top face
		5.0,  5.0, -1.0, 
		5.0,  5.0,  1.0, 
		20.0,  5.0,  1.0, 
		20.0,  5.0, -1.0, 

		//connect bottom face
		5.0, -5.0, -1.0, 
		20.0, -5.0, -1.0, 
		20.0, -5.0,  1.0, 
		5.0, -5.0,  1.0, 

		// right cube Front face
		20.0, -5.0,  5.0, 
		30.0, -5.0,  5.0, 
		30.0,  5.0,  5.0, 
		20.0,  5.0,  5.0, 

		// right cube Back face
		20.0, -5.0, -5.0, 
		20.0,  5.0, -5.0, 
		30.0,  5.0, -5.0, 
		30.0, -5.0, -5.0, 

		// right cube Top face
		20.0,  5.0, -5.0, 
		20.0,  5.0,  5.0, 
		30.0,  5.0,  5.0, 
		30.0,  5.0, -5.0, 

		// right cube Bottom face
		20.0, -5.0, -5.0, 
		30.0, -5.0, -5.0, 
		30.0, -5.0,  5.0, 
		20.0, -5.0,  5.0,

		// right cube Right face
		30.0, -5.0, -5.0, 
		30.0,  5.0, -5.0, 
		30.0,  5.0,  5.0, 
		30.0, -5.0,  5.0, 

		// right cube left-front
		20.0, -5.0, 1.0, 
		20.0, -5.0,  5.0, 
		20.0,  5.0,  5.0, 
		20.0,  5.0, 1.0, 

		// right cube left-back
		20.0, -5.0, -5.0, 
		20.0, -5.0,  -1.0, 
		20.0,  5.0,  -1.0, 
		20.0,  5.0, -5.0
		];

		var vertexTextureCoords  = [
		// left cube Front face
		0.0, 0.0,
		1.0, 0.0,
		1.0, 1.0,
		0.0, 1.0,

		// left cube Back face
		1.0, 0.0,
		1.0, 1.0,
		0.0, 1.0,
		0.0, 0.0,

		// left cube Top face
		0.0, 1.0,
		0.0, 0.0,
		1.0, 0.0,
		1.0, 1.0,

		// left cube Bottom face
		1.0, 1.0,
		0.0, 1.0,
		0.0, 0.0,
		1.0, 0.0,

		// left cube Right-front
		1.0, 0.0,
		1.0, 1.0,
		0.0, 1.0,
		0.0, 0.0,

		// left cube Right-back
		1.0, 0.0,
		1.0, 1.0,
		0.0, 1.0,
		0.0, 0.0,

		// left cube Left face
		0.0, 0.0,
		1.0, 0.0,
		1.0, 1.0,
		0.0, 1.0,

		//connect front face
		0.0, 0.0,
		1.0, 0.0,
		1.0, 1.0,
		0.0, 1.0,

		//connect back face
		1.0, 0.0,
		1.0, 1.0,
		0.0, 1.0,
		0.0, 0.0,

		//connect top face
		0.0, 1.0,
		0.0, 0.0,
		1.0, 0.0,
		1.0, 1.0,

		//connect bottom face
		1.0, 1.0,
		0.0, 1.0,
		0.0, 0.0,
		1.0, 0.0,

		// right cube Front face
		0.0, 0.0,
		1.0, 0.0,
		1.0, 1.0,
		0.0, 1.0,

		// right cube Back face
		1.0, 0.0,
		1.0, 1.0,
		0.0, 1.0,
		0.0, 0.0,

		// right cube Top face
		0.0, 1.0,
		0.0, 0.0,
		1.0, 0.0,
		1.0, 1.0,

		// right cube Bottom face
		1.0, 1.0,
		0.0, 1.0,
		0.0, 0.0,
		1.0, 0.0,

		// right cube Right face
		1.0, 0.0,
		1.0, 1.0,
		0.0, 1.0,
		0.0, 0.0,

		// right cube left-front
		0.0, 0.0,
		1.0, 0.0,
		1.0, 1.0,
		0.0, 1.0,

		// right cube left-back
		0.0, 0.0,
		1.0, 0.0,
		1.0, 1.0,
		0.0, 1.0
	];

	var cubeVertexIndices = [
		0, 1, 2,      0, 2, 3,    // left Front face
		4, 5, 6,      4, 6, 7,    // left Back face
		8, 9, 10,     8, 10, 11,  // left Top face
		12, 13, 14,   12, 14, 15, // left Bottom face
		16, 17, 18,   16, 18, 19, // left Right face-front
		20, 21, 22,   20, 22, 23, // left Right face-back
		24, 25, 26,   24, 26, 27,  // left Left face
		28, 29, 30,   28, 30, 31, //connect front face
		32, 33, 34,   32, 34, 35, //connect back face
		36, 37, 38,   36, 38, 39, //connect top face
		40, 41, 42,   40, 42, 43, //connect bottom face
		44, 45, 46,   44, 46, 47,    // right Front face
		48, 49, 50,      48, 50, 51,    // right Back face
		52, 53, 54,     52, 54, 55,  // right Top face
		56, 57, 58,   56, 58, 59, // right Bottom face
		60, 61, 62,   60, 62, 63, // right Right face
		64, 65, 66,   64, 66, 67, // right Left face-front
		68, 69, 70,   68, 70, 71  // right Left face-back
    ];

	cubeVertexPositionBuffer = gl.createBuffer();
	gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexPositionBuffer);
	gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertexPositions), gl.STATIC_DRAW);
	cubeVertexPositionBuffer.itemSize = 3;
	cubeVertexPositionBuffer.numItems = 216;

	cubeVertexTextureCoordBuffer = gl.createBuffer();
	gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexTextureCoordBuffer);
	gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertexTextureCoords), gl.STATIC_DRAW);
	cubeVertexTextureCoordBuffer.itemSize = 2;
	cubeVertexTextureCoordBuffer.numItems = 144;

	cubeVertexIndexBuffer = gl.createBuffer();
	gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, cubeVertexIndexBuffer);

	gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(cubeVertexIndices), gl.STATIC_DRAW);
	cubeVertexIndexBuffer.itemSize = 1;
	cubeVertexIndexBuffer.numItems = 108;
}